﻿@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Models.Common.Modals
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Models.CustomizableDashboard
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Startup
@inject DashboardViewConfiguration DashboardViewConfiguration
@model AddWidgetViewModel

@await Html.PartialAsync("~/Areas/AppAreaName/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("AddWidget")))

<div class="modal-body">

    @if (Model.Widgets.Any())
    {
        <input hidden id="DashboardName" value="@Model.DashboardName" />
        <input hidden id="PageId" value="@Model.PageId" />
        <div class="form-group">
            <label for="exampleFormControlSelect1">Example select</label>
            <select class="form-control" id="WidgetSelect">
                @for (int i = 0; i < Model.Widgets.Count; i++)
                {
                    var widget = Model.Widgets[i];
                    <option value="@widget.Id">@L(widget.Name)</option>
                }
            </select>
            @for (int i = 0; i < Model.Widgets.Count; i++)
            {
                var widget = Model.Widgets[i];
                var widgetViewDefinition = DashboardViewConfiguration.WidgetViewDefinitions[widget.Id];
                <input hidden id="@(widget.Id + "Height")" value="@widgetViewDefinition.DefaultHeight" />
                <input hidden id="@(widget.Id + "Width")" value="@widgetViewDefinition.DefaultWidth" />
            }
        </div>
    }
    else
    {
        <p>@L("NoWidgetAvailableMessage")</p>
    }

</div>

@await Html.PartialAsync("~/Areas/AppAreaName/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")
